//
//  PHAddUtils.m
//  PhnixHome
//
//  Created by Levy Xu on 2018/2/28.
//  Copyright © 2018年 Levy Xu. All rights reserved.
//

#import "PHAddUtils.h"
#import "QDCommonGridViewController.h"

@implementation PHAddUtils

SingletonM(PHAddUtils, [self initMethod];)

-(void)initMethod {
    _deviceArray = @[[QDGridModel modelWithTitle:NSLocalizedString(@"dev_water_heater1", nil) imageName:@"product_waterheater1"],
                     [QDGridModel modelWithTitle:NSLocalizedString(@"dev_water_heater2", nil) imageName:@"product_waterheater2"],
                     [QDGridModel modelWithTitle:NSLocalizedString(@"dev_water_purifier1", nil) imageName:@"product_waterpurifier1"],
                     [QDGridModel modelWithTitle:NSLocalizedString(@"dev_water_purifier2", nil) imageName:@"product_waterpurifier2"],
                     ];
}

-(NSString *)selectedName {
    QDGridModel *model = _deviceArray[_selectedIndex];
    NSArray *array = [model.title componentsSeparatedByString:@"\n"];
    return array[0];
}

-(NSString *)selectedTitle {
    return [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"add", nil), [self selectedName]];
}

-(UIImage *)selectedImage {
    QDGridModel *model = _deviceArray[_selectedIndex];
    return model.image;
}

@end
